<script lang="ts" setup>
import { Message } from '@arco-design/web-vue'
import { EnrollmentApi } from '@/apis'

const emits = defineEmits(['change'])

const visible = ref<boolean>(false)

const modal = ref<string >('')

const enrollmentId = ref<string>('')

const open = (id: string) => {
  enrollmentId.value = id
  visible.value = true
}

const beforeOk = async () => {
  if (!modal.value) {
    return false
  }
  await EnrollmentApi.addEnroll({ enrollmentId: enrollmentId.value, sellerId: modal.value })
  Message.success('设置课程顾问成功')
  emits('change')
  return true
}

defineExpose({
  open,
})
</script>

<template>
  <a-modal v-model:visible="visible" title="选择课程顾问" @before-ok="beforeOk">
    <EmployeeSelect v-model="modal" type="SELLER" placeholder="选择课程顾问" />
  </a-modal>
</template>

<style lang='less' scoped>
</style>
